import React from 'react';
class TestForm extends React.Component {
    state = {
        name: '',
        password: ''
    }

    getVal = () => {
        console.log(this.state);
    }

    handleName = (ev) => {
        this.setState({ name: ev.target.value })
    }
    handlePwd = (ev) => {
        this.setState({ password: ev.target.value })
    }
    render() {
        return (<div>
            6用户名： <input type="text" value={this.state.name} onChange={this.handleName} /><br />
           6 密码：<input type="text" value={this.state.password} onChange={this.handlePwd} /><br />

            <button onClick={() => { this.getVal() }}>提交</button>
        </div>)
    }
}
export default TestForm;